<?php
/**
 * @name IndexController
 * @author 6p2b7gaqkyoe4aw\administrator
 * @desc 默认控制器
 * @see http://www.php.net/manual/en/class.yaf-controller-abstract.php
 */
error_reporting(E_ALL^E_NOTICE^E_WARNING);
class SellerController extends Yaf_Controller_Abstract {

	
	public function sellerListAction(){
		$info=json_decode(file_get_contents("php://input"),true);
		$categoryid=$info['categoryid'] ? $info['categoryid'] : $_REQUEST['categoryid'];
		$id=$info['id'] ? $info['id'] : $_REQUEST['id'];
		$lat=$info['lat'] ? $info['lat'] : $_REQUEST['lat'];
		$lng=$info['lng'] ? $info['lng'] : $_REQUEST['lng'];
		$lat=$lat ? $lat : '';
		$lng= $lng ? $lng : '';
		$name=$info['name'] ? $info['name'] : $_REQUEST['name'];
		//$goodsname=$info['goodsname'] ? $info['goodsname'] : $_REQUEST['goodsname'];
		
		$where=" 1=1 ";
		
		if($categoryid){
			
			$where.=" and categoryid = '$categoryid' ";
		}
		
		if($id){
			$where.=" and id = '$id' ";
		}
		
		if($name){
		
			$where.=" and name like '%".$name."%' ";
		}
		
		
		$model = new SellerModel();
		if($lat && $lng){
			$list = $model->getList($where,$lat,$lng);
		}else{
			$list = $model->getList($where);
		}
		
		echo json_encode($list);
	}
	
	
	
}
